home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Virtual User / Virtual User Current Release / Tutorial / Script6.vu < prev    next >
Encoding:
Text File  |  1998-06-04  |  1.9 KB  |  59 lines  |  [TEXT/MPS ]

  1. # **********************************************************************
  2. # File:            Script 6.vu
  3. #
  4. # Purpose:        to demonstrate the ability to use localizing techniques
  5. #
  6. # Caution:        To run this script you must change the path to indicate  
  7. #                the current location of the file "Tutorial Localize 
  8. #                Resource." in your host Macintosh.
  9. #                Look for the comment ### !Substitute your path
  10. #                here in the script.
  11. #
  12. # Written by:    David Gaxiola
  13. #
  14. # Copyright © 1992 by Apple Computer, Inc., all rights reserved.
  15. # **********************************************************************
  16.  
  17. # *******************************************************************
  18. # task printFromRsrc( IDNum, howMany, filename )
  19. # will print out the specified number of strings from the file 
  20. # filename or the script file if filename is not specified.
  21. task printFromRsrc( IDNum := 128, howMany := 1, filename ) 
  22. begin
  23.     for counter := 1 to howMany do 
  24.     begin
  25.         if IsUndefined(filename) do
  26.             println getIndString( IDNum, counter );
  27.         else 
  28.             println getIndString( IDNum, counter, filename );
  29.     end;
  30.     println;
  31. end;
  32.  
  33. # *******************************************************************
  34. # Begin main body. #
  35.  
  36. #    Associate the name of the language with its corresponding
  37. #    resource ID number.
  38. script Tutorial6Main()
  39. begin
  40.     languages := { { "English", 773 }, { "Gibberish", 463 }, 
  41.                      { "Français", 838 } };
  42.     listSize := 4;
  43. ### !Substitute your path here -
  44.     thePath := "Tutorial Localize Resource";
  45.  
  46. # Note the use of the assoc built-in task and the 
  47. # printFromRsrc task defined above.
  48.  
  49.     langID := Assoc( "English", languages );
  50.     printFromRsrc( langID, listSize, thePath );
  51.     langID := Assoc( "Français", languages );
  52.     printFromRsrc( langID, listSize, thePath );
  53.     langID := Assoc( "Gibberish", languages );
  54.     printFromRsrc( langID, listSize, thePath );
  55. end;
  56.  
  57. # End main body. 
  58. # *******************************************************************
  59.